#!/bin/bash
#
# Program: Reset all config
# History: 2017/1/25 Kyle.b Release

source ./hack/.func-vars
set -eu

ETH=${1:-""}

role_config "container_network:.*" "container_network: calico" ${GROUP_VARS_PATH}
role_config "cni_iface:.*" "cni_iface: \"\"" ${GROUP_VARS_PATH}
role_config "etcd_iface:.*" "etcd_iface: \"\"" ${GROUP_VARS_PATH}
role_config "vip_interface:.*" "vip_interface: \"\"" ${GROUP_VARS_PATH}
role_config "${SUBNET}.[0-9]*" "${SUBNET}.9" ${GROUP_VARS_PATH}

# clean up
rm -rf ${INVENTORY_PATH} hosts
vagrant destroy -f

vagrant_config "master_count.*" "master_count = 1"
vagrant_config "node_count.*" "node_count = 2"
vagrant_config "system_vcpus.*" "system_vcpus = 1"
vagrant_config "system_memory.*" "system_memory = 2048"
